using System;

using DataLayer;

// Configure log4net using the .config file
[assembly: log4net.Config.XmlConfigurator(Watch=true)]

namespace BusinessLayer {
	public class Person {
		private static readonly log4net.ILog log = log4net.LogManager.GetLogger ("BusinessLayerLogger");
		private string name;
		private int age;
		private double height;

		public string Name {
			get { return name; }
			set { name = value; }
		}

		public int Age {
			get { return age; }
			set { age = value; }
		}

		public double Height {
			get { return height; }
			set { height = value; }
		}

		public void Enroll () {
			log.DebugFormat ("Enrolling {0}", this.Name);

			PersonDTO dto = new PersonDTO();
			dto.Name = name;
			dto.Age = age;
			dto.Height = height;
			
			PersonDataAccess.Save (dto);
		}

		public static Person[] GetList () {
			log.Info ("Getting list person.");

			PersonDTO[] lista = new PersonDTO[10];
			lista = PersonDataAccess.GetList ();
			
			Person[] gente = new Person[10];
			
			for (int ix = 0; ix < lista.Length; ix++) {
				gente[ix].Name = lista[ix].Name;
				gente[ix].Age = lista[ix].Age;
				gente[ix].Height = lista[ix].Height;
			}
			
			return gente;
		}
	}
}
